package org.zjx.swing.util;

import org.zjx.swing.bean.FontFilePath;

import javax.swing.*;
import java.awt.*;

public class PathItemRenderer extends DefaultListCellRenderer {
    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        if (value instanceof FontFilePath) {
            FontFilePath item = (FontFilePath) value;
            String displayText = item.toString();

            // 调用父类方法设置基本样式
            Component renderer = super.getListCellRendererComponent(list, displayText, index, isSelected, cellHasFocus);

            // 可根据需要进一步自定义外观
            return renderer;
        }
        return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    }
}
